package com.example.base_kotlin_xml.adapter

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.example.base_kotlin_xml.R
import com.example.base_model.room.bean.User

/**
 * @Author jiangKunKun
 * @CreateDate 2025/7/24
 * @Description
 * @SpittingGrooves
 */
class RoomAdapter : BaseQuickAdapter<User, QuickViewHolder>() {
    override fun onBindViewHolder(
        holder: QuickViewHolder,
        position: Int,
        item: User?
    ) {
        holder.setText(R.id.tv_user_id, item?.id.toString())
            .setText(R.id.tv_user_name, item?.name)
            .setText(R.id.tv_user_email, item?.email ?: "未设置邮箱")
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_user, parent)
    }

}